<?php

/**
 * Feedback form base class.
 *
 * @method Feedback getObject() Returns the current form's model object
 *
 * @package    Coverd
 * @subpackage form
 * @author     Cameron Ross
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseFeedbackForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                          => new sfWidgetFormInputHidden(),
      'source_id'                   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Source'), 'add_empty' => false)),
      'title'                       => new sfWidgetFormTextarea(),
      'content'                     => new sfWidgetFormTextarea(),
      'name'                        => new sfWidgetFormInputText(),
      'rating'                      => new sfWidgetFormInputText(),
      'is_read'                     => new sfWidgetFormInputText(),
      'version'                     => new sfWidgetFormInputText(),
      'device_type'                 => new sfWidgetFormInputText(),
      'submitted_date'              => new sfWidgetFormDateTime(),
      'retrieved_date'              => new sfWidgetFormDateTime(),
      'added_source_refresh_run_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SourceRefreshRun'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'source_id'                   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Source'))),
      'title'                       => new sfValidatorString(array('required' => false)),
      'content'                     => new sfValidatorString(array('required' => false)),
      'name'                        => new sfValidatorString(array('max_length' => 128, 'required' => false)),
      'rating'                      => new sfValidatorInteger(array('required' => false)),
      'is_read'                     => new sfValidatorInteger(array('required' => false)),
      'version'                     => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'device_type'                 => new sfValidatorString(array('max_length' => 64, 'required' => false)),
      'submitted_date'              => new sfValidatorDateTime(array('required' => false)),
      'retrieved_date'              => new sfValidatorDateTime(),
      'added_source_refresh_run_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SourceRefreshRun'))),
    ));

    $this->widgetSchema->setNameFormat('feedback[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Feedback';
  }

}
